var t = require("../common.js"), a = getApp();

Page({
    behaviors: [ t ],
    data: {
        types: [ {
            title: "全部记录",
            name: "all"
        }, {
            title: "待审核",
            name: 0
        }, {
            title: "待打款",
            name: 1
        }, {
            title: "打款中",
            name: 4
        }, {
            title: "已打款",
            name: 2
        }, {
            title: "已驳回",
            name: 3
        }, {
            title: "无效提现",
            name: -1
        } ],
        status: "all",
        keyword: "",
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        networkLoading: !1
    },
    onLoad: function(t) {
        this.getListData();
    },
    initPage: function() {
        this.setData({
            listData: [],
            networkLoading: !1
        }), this.data.page = 1, this.data.total_page = 0, this.data.isLoadMore = !0;
    },
    handSearch: function(t) {
        this.data.keyword = t.detail, this.getListData();
    },
    onReady: function() {},
    onShow: function() {},
    changeTabs: function(t) {
        this.data.status = t.detail.name, this.getListData();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore && this._getMoreData();
    },
    getListData: function() {
        var t = this;
        this.initPage();
        var s = {};
        s.search = {
            member: this.data.keyword,
            status: "all" == this.data.status ? "" : this.data.status
        };
        var e = a.getNetAddresss("plugin.shop-assistant.frontend.withdraw.withdraw-list");
        a._postNetWork({
            url: e,
            data: s,
            success: function(s) {
                var e = s.data;
                if (1 != e.result) return a.tips(e.msg);
                t.data.total_page = e.data.last_page, t.data.total_page || (t.data.total_page = 0), 
                t.setData({
                    listData: e.data.data,
                    networkLoading: !0
                });
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var s = {
                page: this.data.page
            };
            s.search = {
                member: this.data.keyword,
                status: "all" == this.data.status ? "" : this.data.status
            };
            var e = a.getNetAddresss("plugin.shop-assistant.frontend.withdraw.withdraw-list");
            a._postNetWork({
                url: e,
                data: s,
                success: function(a) {
                    var s = a.data;
                    if (t.data.isLoadMore = !0, 1 === s.result) {
                        var e = t.data.listData.concat(s.data.data);
                        t.setData({
                            listData: e
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    },
    onShareAppMessage: function() {}
});